/*
 *接口编写处...
*如果接口需要做Action的权限验证，请在Action上使用属性
*如: [ApiActionPermission("cw_djlc_cwzb",Enums.ActionPermissionOptions.Search)]
 */
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Http;
using VOL.Entity.DomainModels;
using VOL.Finance.IServices;
using Microsoft.AspNetCore.Mvc.RazorPages;
using VOL.Core.Utilities;
using VOL.Core.DBManager;
using VOL.Core.Filters;

namespace VOL.Finance.Controllers
{
    public partial class cw_djlc_cwzbController
    {
        private readonly Icw_djlc_cwzbService _service;//访问业务代码
        private readonly IHttpContextAccessor _httpContextAccessor;

        [ActivatorUtilitiesConstructor]
        public cw_djlc_cwzbController(
            Icw_djlc_cwzbService service,
            IHttpContextAccessor httpContextAccessor
        )
        : base(service)
        {
            _service = service;
            _httpContextAccessor = httpContextAccessor;
        }
        public override ActionResult Import(List<IFormFile> fileInput)
        {
            return base.Import(fileInput);
        }

        public override ActionResult Add([FromBody] SaveModel saveModel)
        {
            return base.Add(saveModel);
        }

        public override ActionResult GetPageData([FromBody] PageDataOptions loadData)
        {
            return base.GetPageData(loadData);
        }
        [HttpPost, Route("update1")]
        [ApiActionPermission()]
        public ActionResult update1(string vehiclelogisticsfee,string cw_djlc_cwzb_id)
        {
            WebResponseContent webResponse = new WebResponseContent();
            if (vehiclelogisticsfee != null && !"".Equals(vehiclelogisticsfee))
            {
                string sql = "update cw_djlc_cwzb set [vehiclelogisticsfee] = @vehiclelogisticsfee where cw_djlc_cwzb_id = @cw_djlc_cwzb_id";
                DBServerProvider.SqlDapper.ExcuteNonQuery(sql, new { vehiclelogisticsfee, cw_djlc_cwzb_id });
                return Json(webResponse.OK("保存成功！"));
            }
            else
            {
                return Json(webResponse.Error("请正确填写费用！"));
            }
            
        }
    }
}
